import request from '@/utils/request'

// 查询Jar包管理列表
export function listJarmanagement(query) {
    return request({
        url: '/resource/jarmanagement/list',
        method: 'get',
        params: query
    })
}

// 查询Jar包管理详细
export function getJarmanagement(id) {
    return request({
        url: '/resource/jarmanagement/' + id,
        method: 'get'
    })
}

// 新增Jar包管理
export function addJarmanagement(data) {
    return request({
        url: '/resource/jarmanagement',
        method: 'post',
        data: data
    })
}

// 修改Jar包管理
export function updateJarmanagement(data) {
    return request({
        url: '/resource/jarmanagement',
        method: 'put',
        data: data
    })
}

// 删除Jar包管理
export function delJarmanagement(id) {
    return request({
        url: '/resource/jarmanagement/' + id,
        method: 'delete'
    })
}

/**
 * 删除临时文件
 * @param data
 * @returns {AxiosPromise}
 */
export function removeHdfsTmp(data) {
    return request({
        url: '/resource/jarmanagement/removeHdfsTmp',
        method: 'post',
        data:data
    })
}

export function getJarListByAppId(appId) {
    return request({
        url: '/resource/jarmanagement/getJarListByAppId/'+appId,
        method: 'get'
    })
}


export function getDefaultLog()
{
    return '<!--\n' +
        '  ~ Licensed to the Apache Software Foundation (ASF) under one\n' +
        '  ~ or more contributor license agreements.  See the NOTICE file\n' +
        '  ~ distributed with this work for additional information\n' +
        '  ~ regarding copyright ownership.  The ASF licenses this file\n' +
        '  ~ to you under the Apache License, Version 2.0 (the\n' +
        '  ~ "License"); you may not use this file except in compliance\n' +
        '  ~ with the License.  You may obtain a copy of the License at\n' +
        '  ~\n' +
        '  ~     http://www.apache.org/licenses/LICENSE-2.0\n' +
        '  ~\n' +
        '  ~ Unless required by applicable law or agreed to in writing, software\n' +
        '  ~ distributed under the License is distributed on an "AS IS" BASIS,\n' +
        '  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n' +
        '  ~ See the License for the specific language governing permissions and\n' +
        '  ~ limitations under the License.\n' +
        '  -->\n' +
        '\n' +
        '<configuration>\n' +
        '    <appender name="file" class="ch.qos.logback.core.FileAppender">\n' +
        '        <file>${log.file}</file>\n' +
        '        <append>false</append>\n' +
        '        <encoder>\n' +
        '            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{60} %X{sourceThread} - %msg%n</pattern>\n' +
        '        </encoder>\n' +
        '    </appender>\n' +
        '\n' +
        '    <!-- This affects logging for both user code and Flink -->\n' +
        '    <root level="INFO">\n' +
        '        <appender-ref ref="file"/>\n' +
        '    </root>\n' +
        '\n' +
        '    <!-- Uncomment this if you want to only change Flink\'s logging -->\n' +
        '    <!--<logger name="org.apache.flink" level="INFO">-->\n' +
        '        <!--<appender-ref ref="file"/>-->\n' +
        '    <!--</logger>-->\n' +
        '\n' +
        '    <!-- The following lines keep the log level of common libraries/connectors on\n' +
        '         log level INFO. The root logger does not override this. You have to manually\n' +
        '         change the log levels here. -->\n' +
        '    <logger name="akka" level="INFO">\n' +
        '        <appender-ref ref="file"/>\n' +
        '    </logger>\n' +
        '    <logger name="org.apache.kafka" level="INFO">\n' +
        '        <appender-ref ref="file"/>\n' +
        '    </logger>\n' +
        '    <logger name="org.apache.hadoop" level="INFO">\n' +
        '        <appender-ref ref="file"/>\n' +
        '    </logger>\n' +
        '    <logger name="org.apache.zookeeper" level="INFO">\n' +
        '        <appender-ref ref="file"/>\n' +
        '    </logger>\n' +
        '\n' +
        '    <!-- Suppress the irrelevant (wrong) warnings from the Netty channel handler -->\n' +
        '    <logger name="org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline" level="ERROR">\n' +
        '        <appender-ref ref="file"/>\n' +
        '    </logger>\n' +
        '</configuration>\n'
}




